package week03.saas;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangxiaokun on 2018/2/7.
 * 枚举 多例模式
 */
public class Season {
    private String name;
    public static final Season spring = new Season("春");
    public static final Season summer = new Season("夏");
    public static final Season autumn = new Season("秋");
    public static final Season winter = new Season("冬");

    private Season(){
        super();
    }
    private Season(String name){
        this.name = name;
    }

    public static List<Season> getSeasons() {
        List<Season> list = new ArrayList<>();
        list.add(spring);
        list.add(summer);
        list.add(autumn);
        list.add(winter);
        return list;
    }

    public String getName() {
        return name;
    }

    public static void main(String[] args) {
        System.out.println(Season.spring.getClass());
        System.out.println(Season.spring);
        System.out.println(Season.summer);
        System.out.println(Season.autumn);
        System.out.println(Season.winter);

        System.out.println("========");

        List<Season> list = Season.getSeasons();
        for (Season bean : list) {
            System.out.println(bean.getName());
        }
    }
}
